package com.rraj.common.mq.test.constant;

/**
 * Created by WangSheng on 2017/6/19.
 *
 * @author WangSheng
 * @date 2017/06/19
 */
public enum MQTestTagEnum {
    TAG_DEFAULT_TEST_TOPIC1_SYNC(1, "TAG_DEFAULT_TEST_TOPIC1_SYNC", "TOPIC_DEFAULT_TEST_TOPIC1",
        "TAG_DEFAULT_TEST_TOPIC1_SYNC", "同步无序消息"),
    TAG_DEFAULT_TEST_TOPIC1_ASYNC(1, "TAG_TEST_SYNC", "TOPIC_DEFAULT_TEST_TOPIC1", "TAG_DEFAULT_TEST_TOPIC1_ASYNC",
        "异步无序消息"),
    TAG_DEFAULT_TEST_TOPIC1_ONEWAY(1, "TAG_DEFAULT_TEST_TOPIC1_ONEWAY", "TOPIC_DEFAULT_TEST_TOPIC1",
        "TAG_DEFAULT_TEST_TOPIC1_ONEWAY", "单向无序消息"),
    TAG_DEFAULT_TEST_TOPIC1_TIMING(1, "TAG_DEFAULT_TEST_TOPIC1_TIMING", "TOPIC_DEFAULT_TEST_TOPIC1",
        "TAG_DEFAULT_TEST_TOPIC1_TIMING", "定时消息"),
    TAG_DEFAULT_TEST_TOPIC1_DELAY(1, "TAG_DEFAULT_TEST_TOPIC1_DELAY", "TOPIC_DEFAULT_TEST_TOPIC1",
        "TAG_DEFAULT_TEST_TOPIC1_DELAY", "延时消息"),
    TAG_TRANSACTION_TEST_TOPIC1_TAG1(1, "TAG_TRANSACTION_TEST_TOPIC1_TAG1", "TOPIC_TRANSACTION_TEST_TOPIC1",
        "TAG_TRANSACTION_TEST_TOPIC1_TAG1", "事务消息"),
    TAG_ALL_ORDER_TEST_TOPIC1_TAG1(1, "TAG_ALL_ORDER_TEST_TOPIC1_TAG1", "TOPIC_ALL_ORDER_TEST_TOPIC1",
        "TAG_ALL_ORDER_TEST_TOPIC1_TAG1", "全局顺序消息"),
    TAG_SHARDING_ORDER_TEST_TOPIC1_TAG1(1, "TAG_SHARDING_ORDER_TEST_TOPIC1_TAG1", "TOPIC_SHARDING_ORDER_TEST_TOPIC1",
        "TAG_SHARDING_ORDER_TEST_TOPIC1_TAG1", "分区顺序消息");

    /**
     * 唯一标识
     */
    private int id;
    /**
     * TAG的code
     * 命名格式：TAG_TAG名称
     */
    private String code;
    /**
     * 所属的topic
     */
    private String topic;
    /**
     * 所属的tag的值
     */
    private String value;
    /**
     * 描述
     */
    private String desc;

    MQTestTagEnum(int id, String code, String topic, String value, String desc) {
        this.id = id;
        this.code = code;
        this.topic = topic;
        this.value = value;
        this.desc = desc;
    }

    public static MQTestTagEnum getEnumById(int id) {
        for (MQTestTagEnum c : MQTestTagEnum.values()) {
            if (c.getId() == id) {
                return c;
            }
        }
        return null;
    }

    public static MQTestTagEnum getEnumByCode(String code) {
        for (MQTestTagEnum c : MQTestTagEnum.values()) {
            if (c.getCode().equals(code)) {
                return c;
            }
        }
        return null;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
